package provatable;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the "USER" database table.
 * 
 */
@Entity
@Table(name="\"USER\"")
@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private long oid;

	private String email;

	private String nome;

	private String password;

	private String telefono;

	private String username;

	//bi-directional many-to-one association to Canale
	@OneToMany(mappedBy="user")
	private List<Canale> canales;

	//bi-directional many-to-one association to ContenutoMultimediale
	@ManyToOne
	@JoinColumn(name="CONTENUTO_MULTIMEDIALE_OID")
	private ContenutoMultimediale contenutoMultimediale;

	//bi-directional many-to-one association to Group
	@ManyToOne
	private Group group;

	//bi-directional many-to-one association to Gruppo
	@ManyToOne
	private Gruppo gruppo;

	//bi-directional many-to-one association to Locale
	@ManyToOne
	private Locale locale;

	//bi-directional many-to-many association to Group
	@ManyToMany
	@JoinTable(
		name="USER_GROUP"
		, joinColumns={
			@JoinColumn(name="USER_OID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="GROUP_OID")
			}
		)
	private List<Group> groups;

	public User() {
	}

	public long getOid() {
		return this.oid;
	}

	public void setOid(long oid) {
		this.oid = oid;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getTelefono() {
		return this.telefono;
	}

	public void setTelefono(String telefono) {
		this.telefono = telefono;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public List<Canale> getCanales() {
		return this.canales;
	}

	public void setCanales(List<Canale> canales) {
		this.canales = canales;
	}

	public Canale addCanale(Canale canale) {
		getCanales().add(canale);
		canale.setUser(this);

		return canale;
	}

	public Canale removeCanale(Canale canale) {
		getCanales().remove(canale);
		canale.setUser(null);

		return canale;
	}

	public ContenutoMultimediale getContenutoMultimediale() {
		return this.contenutoMultimediale;
	}

	public void setContenutoMultimediale(ContenutoMultimediale contenutoMultimediale) {
		this.contenutoMultimediale = contenutoMultimediale;
	}

	public Group getGroup() {
		return this.group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	public Gruppo getGruppo() {
		return this.gruppo;
	}

	public void setGruppo(Gruppo gruppo) {
		this.gruppo = gruppo;
	}

	public Locale getLocale() {
		return this.locale;
	}

	public void setLocale(Locale locale) {
		this.locale = locale;
	}

	public List<Group> getGroups() {
		return this.groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}

}